﻿using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Permission.Abstract
{

    /// <summary>
    /// 权限定义类
    /// </summary>
    public class PermissionDefinition
    {
        public string? Name { get; set; }

        public string? DisplayName { get; set; }

        public IReadOnlyList<PermissionDefinition> Children => _children.ToImmutableList();
            //.ToImmutableList();
        private readonly List<PermissionDefinition>? _children;

        public PermissionDefinition(string name, string displayName)
        {
            Name = name;
            DisplayName = displayName;
            if (_children?.Count() == 0)
            {
                _children = new List<PermissionDefinition>();
            }
        }
    }
}
